<?php

class Engine_Controller_Plugin_Blacklist extends Zend_Controller_Plugin_Abstract {

	
	public function __construct(Array $options = array())
    {
		$this->init($options);
    }

    public function init(array $options) {
    }
    
    public function routeStartup($request) {
    	$ip = $_SERVER['REMOTE_ADDR'];
		$core_blacklist = new Engine_Db_Table_CoreBlacklist();
		$select = $core_blacklist->select()
								 ->where("blacklist_type_id = 'blacklist_ip' AND blacklist_value = '$ip'");
    	$results = $core_blacklist->fetchRow($select);	
    	if ($results) {
			$this->getResponse()->clearBody();
			$this->getResponse()->clearHeaders();
    		throw new Zend_Controller_Action_Exception($ip, 466);  
    	}
    }
    

}
?>